// 导入路由相关的包用于创建路由对象
import VueRouter from 'vue-router'

// 导入对应的路由组件,然后把路由关系配置好(意思就是跳转到哪个组件并展示出来),
// "./"表示引入的文件都在当前目录下,即src下,这样才能找到文件
import HomeContainer from './components/tabbar/HomeContainer.vue'
import MemberContainer from './components/tabbar/MemberContainer.vue'
import ShopcarContainer from './components/tabbar/ShopcarContainer.vue'
import SearchContainer from './components/tabbar/SearchContainer.vue'
import NewsList from './components/News/NewsList.vue'
import NewsInfo from './components/News/NewsInfo.vue'
import photoList from './components/photos/photoList.vue'

// 3. 创建路由对象
var router = new VueRouter({
  routes: [ // 配置路由规则,也就是链接和组件之间的对应关系,点击链接地址栏会发生改变,
            // 路由会监听到改变进行路由规则的匹配,
            // 并展示对应的页面(这里要先规定组件展示的位置,
            // 指定一个"坑"来存放我们的组件,这个坑是<router-view></router-view>)
     { path: '/', redirect: '/home' },       
     { path: '/home', component: HomeContainer},
     { path: '/member', component: MemberContainer},
     { path: '/shopcar', component: ShopcarContainer},
     { path: '/search', component: SearchContainer},
     { path: '/home/newsList', component: NewsList},
     { path: '/home/newsinfo/:id', component: NewsInfo},
     { path: '/home/photolist/', component: photoList}
  ],
  linkActiveClass: 'mui-active' //覆盖默认的路由高亮的类 ,默认的类叫做router-link-active
})

// 把路由对象暴露出去,export default 的作用就是暴露对象的
export default router